<template>
  <view class="page-wrapper">
    <JSearchTitle place="搜索门店名称、ID" @tap="ak.go.toSearchPage('mchStore')"/>
	
	<JeepayTableList ref="jeepayTableListRef" :reqTableDataFunc="reqTableDataFunc">
		<template #tableBody="{ record }">
			 <MchStoreRender :record="record" />
		</template>
	</JeepayTableList>
	
	<view v-if="ak.ent.has('ENT_MCH_STORE_ADD')" class="list-footer">
		<view class="button-wrapper">
			<Button @tap="createStore">创建门店</Button>
		</view>
	</view>
	
  </view>
</template>

<script setup>
import { nextTick, reactive, ref } from "vue"
import { onReachBottom, onShow, onUnload } from '@dcloudio/uni-app'
import ak from '@/commons/utils/ak.js'
import { reqLoad, API_URL_MCH_STORE_LIST } from "@/http/apiManager.js"
import MchStoreRender from '@/pages/list/render/MchStoreRender.vue'

const jeepayTableListRef = ref()

onReachBottom(() => { })

// 监听 更新事件 
onUnload(() => uni.$off(ak.emit.ENAME_REF_STORE_LIST))
uni.$on(ak.emit.ENAME_REF_STORE_LIST, function(data){
	jeepayTableListRef.value.refTable(true)
})

// 请求
function reqTableDataFunc (params) {
    return reqLoad.list(API_URL_MCH_STORE_LIST, params)
}
	
const createStore = () => ak.go.to("PAGES_APP_STORE_EDIT")
</script>
<style lang="scss" scoped>
	
</style>
